﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data;
using DTO;

namespace DAO
{
   public class DAO_TacGia
    {
        public static bool themtacgia(DTO_tacgia tg)
        {
            string truyvan = string.Format("insert into tacgia(tentg) values('" +tg.Tentg  + "')");
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }
        public static bool xoatacgia(DTO_tacgia tg)
        {
            string truyvan = string.Format("delete from tacgia where matg =" + tg.Matg);
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }
        public static bool suatacgia(DTO_tacgia tg)
        {
            string truyvan = string.Format("update tacgia set tentg='" + tg.Tentg + "' where matg =" + tg.Matg);
            if (DataProvider.Capnhatdl(truyvan) > 0)
            {
                return true;
            }
            return false;
        }

        public static DataTable LayDSTacGia() {
            return DataProvider.laydulieubang("Select * from TacGia", DataProvider.c);
        }
    }
}
